{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ed52e2d2",
   "metadata": {},
   "source": [
    "# 课后实践\n",
    "* 将字典的所有方法 用表格形式做学习记录  \n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ad4f9bd2",
   "metadata": {},
   "source": [
    "## 作业"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8b93d8fa",
   "metadata": {},
   "source": [
    "|序号|字典的方法|用法|使用结果|注意事项|\n",
    "|---|-----|-----|-----|----|\n",
    "|1|fromkeys()|D.fromkeys()|Create a new dictionary with keys from iterable and values set to value.|把字符串’num’里每一个字符都当做一个key来进行创建字典，如果要想把整个字符串当做key来使用，将字符串放入list或者tuple即可。\n",
    "|2|setdefault()|D.setdefault()|Insert key with a value of default if key is not in the dictionary.| Return the value for key if key is in the dictionary, else default.\n",
    "|3|字典的删除pop()| D.pop(k[,d])| remove specified key and return the corresponding value|KeyError出现情况：key找不到|\\n\",\n",
    "|4|字典查询所有关键字keys()|D.keys()|a set-like object providing a view on D's keys|keys的结果是什么类型|\n",
    "|5|字典中所有键对应的值（value）|D.values()| an object providing a view on D's values|\n",
    "|6|字典的随机删除popitem()|D.popitem()| Remove and return a (key, value) pair as a 2-tuple.|Pairs are returned in LIFO (last-in, first-out) order.Raises KeyError if the dict is empty.\n",
    "|7|更新己有的字典update()|D.update([E, ]**F)|Update D from dict|如果被更新的字典中己包含对应的键值对，那么原 value 会被覆盖；如果被更新的字典中不包含对应的键值对，则该键值对被添加进去。\n",
    "|8|字典的拷贝copy()|D.copy()|a shallow copy of D|改代码时需要记得先copy一份源代码，以防后面代码找不到"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "88ecb5e4",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c3482ed4",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
